package vn.demand.dragon.model.business
{
	import mx.rpc.AsyncToken;
	import mx.rpc.events.FaultEvent;
	import mx.rpc.events.ResultEvent;
	import mx.rpc.http.HTTPService;

	public class LoadTasksByReferenceDelegate 
	{
		private var responder : Function;
		private var failer : Function;
		private var service : HTTPService;

		public function LoadTasksByReferenceDelegate( responder : Function , failer : Function) 
		{
			// constructor will store a reference to the service we're going to call
			this.service = new HTTPService();
			this.service.url = "http://dev.dragon.com/index.php?m=projects&a=tasks_of_reference&suppressHeaders=1";
//			this.service.url = "data/tasks_of_reference.xml";
			this.service.method = 'GET';
			this.service.resultFormat = 'e4x';
			
			this.service.addEventListener(ResultEvent.RESULT, responder);
			this.service.addEventListener(FaultEvent.FAULT, failer);
		}

		public function loadTaskByReferenceService(reference:int) : void 
		{
			RIALogger.debug(this, "Load Task Service");
			var token:AsyncToken = service.send({'reference': reference});
		}
	}
}